<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<!-- 页面适配设备的宽度 然移动端按照实际的像素比例设置-->
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
	<title>2021.8.9</title>
	<link rel="stylesheet" href="css/index.css">
	<link rel="stylesheet" href="css/my.css">
</head>
<body>
	<img src="./images/404.jpg" alt="">
	<br>
	再捅几刀？
	<span class="dao"></span>
	<div class="attack">
		<span class="puci">噗呲</span>
		<span class = 'tong'style="color: green">捅</span>
		<span class = 'baotong'style="color: red">暴捅</span>
		<span class="texiao">刀</span>
	</div>
	<input type="text" class="timeInpt" placeholder="歹徒行凶时间">
	<br>
	<span class="define">开始行凶(￣(工)￣)</span>
	<div class="bottom_nav clearfix">
		<div>
			<span>首页</span>
		</div>
		<div>
			<span>消息</span>
		</div>
		<div>
			<span>我的</span>
		</div>
	</div>
<script type="text/javascript">
	var change = document.querySelectorAll('.bottom_nav div');
	change[0].onclick = function (){
		location.href="./index.htm";
	}
	change[1].onclick = function (){
		location.href="./404.htm";
	}
	change[2].onclick = function (){
		location.href="./my.htm";
	}
	// 总刀数
	var dao = document.querySelector('.dao');
	var daoNum = Number(dao.innerHTML);
	// 屠龙刀数
	var dragon = 0;
	// 屠龙龟
	var puci = document.querySelector('.puci');
	// 普通噗呲
	var tong = document.querySelector('.tong');
	// 暴击噗呲
	var baotong = document.querySelector('.baotong');
	var texiao = document.querySelector('.texiao');
	// 获取用户输入的时间值
	var time = null;
	var timeInpt = document.querySelector('.timeInpt');
	// 确定行凶按钮
	var define = document.querySelector('.define');
	//普通噗呲
	tong.onclick = function (){
		puci.style.opacity = 0;
		dao.innerHTML = daoNum += 10;
		var infinite = parseInt(Math.random()*28);
		if(infinite == 10){
			daoNum += 9999;
			dragon++;
			puci.style.opacity = 1;
		}
	}
	//暴击噗呲
	baotong.onclick = function (){
		// 随机屠龙(龟)刀产生
		dao.innerHTML = daoNum += parseInt(Math.random()*666);
		texiao.style.display = 'block';
		texiao.style.color = randomColor();
		daoNum = Number(dao.innerHTML);
	}
	// 获取时间
	var timer = null;
	define.onclick = function (){
		define.style.visibility = 'hidden';
		time = Number(timeInpt.value);
		//严谨算法， 判断拿来的值是否符合标准
		if (time != null) {
		// 4000一套太极拳
		timer = setTimeout(function(){
			alert('对方坚持打完'+ time/4000 + '套太极拳了,你一共捅了' + dao.innerHTML + '刀,屠龙(龟)刀数'+dragon+'继续加油吧');
			define.style.visibility = 'visible';
			dao.innerHTML = null;
			daoNum = 0;
			texiao.style.display = 'none';
			},time);
		} else{
			console.log("输入数字")
		}
		timeInpt.value = '';
	}
	// 生成随机颜色
	function randomColor() {
	var str = "rgb(" + parseInt(Math.random()*256) + "," + parseInt(Math.random()*256) + "," + parseInt(Math.random()*256) + ")";
		return str;
	}
</script>
</body>
</html>